<!DOCTYPE HTML>
<!--
	Dimension by HTML5 UP
	html5up.net | @ajlkn
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
 <head>
  <title>
   Dimension by HTML5 UP
  </title>
  <!-- <meta charset="utf-8" /> -->
  <!-- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> -->
  <meta charset="utf-8"/>
  <meta content="width=device-width,initial-scale=1.0" name="viewport"/>
  <link href="../../assets/css/article.css" rel="stylesheet"/>
  <link href="https://cdn.bootcss.com/highlight.js/9.15.8/styles/github.min.css" rel="stylesheet"/>
  <noscript>
   <link href="../../assets/css/noscript.css" rel="stylesheet"/>
  </noscript>
 </head>
 <body>
  <div id="app">
  </div>
  <!-- built files will be auto injected -->
 </body>
 <body class="is-preload">
  <!-- Wrapper -->
  <div id="wrapper">
   <!-- Main -->
   <div id="main">
    <article id="article">
     <h1 id="_1">
      内网远程连接
     </h1>
     <hr/>
     <h2 id="ssh">
      SSH
     </h2>
     <div class="codehilite">
      <pre><span></span><code><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">ssh</span> <span class="o">-</span><span class="n">L</span> <span class="mi">2224</span><span class="o">:</span><span class="mf">127.0.0.1</span><span class="o">:</span><span class="mi">2224</span> <span class="o">-</span><span class="n">R</span> <span class="mi">2224</span><span class="o">:</span><span class="mf">127.0.0.1</span><span class="o">:</span><span class="mi">2225</span> <span class="o">-</span><span class="n">NR</span> <span class="mi">40004</span><span class="o">:</span><span class="nl">localhost</span><span class="p">:</span><span class="mi">22</span> <span class="o">-</span><span class="n">p</span> <span class="mi">2822</span> <span class="n">root</span><span class="mf">@119.39.96.61</span>
</code></pre>
     </div>
     <h2 id="autossh">
      AutoSSH
     </h2>
     <h3 id="ctenos">
      Ctenos
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="c">http://www.harding.motd.ca/autossh/autossh-1.4f.tgz</span>
</code></pre>
     </div>
     <h3 id="_2">
      秘钥建立
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="err">#</span><span class="w"> </span><span class="n">Client</span><span class="w"></span>
<span class="n">ssh</span><span class="o">-</span><span class="n">keygen</span><span class="w"> </span><span class="o">-</span><span class="n">t</span><span class="w"> </span><span class="n">rsa</span><span class="w"></span>
<span class="n">scp</span><span class="w"> </span><span class="o">/</span><span class="n">root</span><span class="o">/</span><span class="p">.</span><span class="n">ssh</span><span class="o">/</span><span class="n">id_rsa</span><span class="p">.</span><span class="n">pub</span><span class="w"> </span><span class="n">root</span><span class="nv">@xxx</span><span class="p">.</span><span class="n">xx</span><span class="p">.</span><span class="n">xx</span><span class="p">.</span><span class="nl">xx</span><span class="p">:</span><span class="o">/</span><span class="n">root</span><span class="o">/</span><span class="p">.</span><span class="n">ssh</span><span class="o">/</span><span class="n">test_pub</span><span class="w"></span>

<span class="err">#</span><span class="w"> </span><span class="n">Server</span><span class="w"></span>
<span class="n">cat</span><span class="w"> </span><span class="o">/</span><span class="n">root</span><span class="o">/</span><span class="p">.</span><span class="n">ssh</span><span class="o">/</span><span class="n">test_pub</span><span class="w"> </span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="o">/</span><span class="n">root</span><span class="o">/</span><span class="p">.</span><span class="n">ssh</span><span class="o">/</span><span class="n">authorized_keys</span><span class="w"></span>
</code></pre>
     </div>
     <h3 id="autossh_1">
      安装AutoSSH
     </h3>
     <p>
      autossh下载地址：http://www.harding.motd.ca/autossh/
     </p>
     <div class="codehilite">
      <pre><span></span><code><span class="err">tar -xf ****</span>
<span class="err">cd ****</span>
<span class="err">./configure</span>
<span class="err">make</span>
<span class="err">make install</span>
</code></pre>
     </div>
     <h3 id="_3">
      运行
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="n">autossh</span> <span class="o">-</span><span class="n">M</span> <span class="mi">2222</span> <span class="o">-</span><span class="n">NfR</span> <span class="mi">40002</span><span class="o">:</span><span class="nl">localhost</span><span class="p">:</span><span class="mi">22</span> <span class="n">user</span><span class="p">@</span><span class="n">ip</span> <span class="o">-</span><span class="n">p</span> <span class="mi">22</span>
<span class="n">autossh</span> <span class="o">-</span><span class="n">M</span> <span class="mi">2222</span> <span class="o">-</span><span class="n">NfR</span> <span class="mi">40002</span><span class="o">:</span><span class="nl">localhost</span><span class="p">:</span><span class="mi">22</span> <span class="n">root</span><span class="mf">@119.39.96.61</span> <span class="o">-</span><span class="n">p</span> <span class="mi">2822</span>
<span class="n">service</span> <span class="n">client_nssas</span> <span class="n">restart</span>

<span class="p">.</span><span class="o">/</span><span class="n">otunnel</span> <span class="n">connect</span> <span class="mf">119.39.96.61</span><span class="o">:</span><span class="mi">40007</span> <span class="o">-</span><span class="n">s</span> <span class="n">longlongsecret</span> <span class="o">-</span><span class="n">t</span> <span class="err">'</span><span class="nl">r</span><span class="p">:</span><span class="mf">10.0.0.46</span><span class="o">:</span><span class="mi">22</span><span class="o">::</span><span class="mi">40008</span><span class="err">'</span>
</code></pre>
     </div>
     <h3 id="linkin-sever">
      LINK(IN SEVER)
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="err">ssh -p 40002 user@localhsot</span>
</code></pre>
     </div>
     <h2 id="otunnel">
      otunnel
     </h2>
     <h3 id="_4">
      下载安装
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="err">wget https://dl.ooclab.com/otunnel/1.3.1/otunnel_linux_amd64</span>
<span class="err">chmod a+x otunnel_linux_amd64</span>
<span class="err">mv otunnel_linux_amd64 /opt/otunnel</span>
</code></pre>
     </div>
     <h3 id="_5">
      服务端运行
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="err">/opt/otunnel listen :40007 -s longlongsercret</span>
</code></pre>
     </div>
     <h3 id="_6">
      客户端运行（反向连接）
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="err">/opt/otunnel connect 119.39.96.61:40007 -s longlongsecret -t 'r:10.0.0.46:22::40008'</span>
</code></pre>
     </div>
     <h2 id="_7">
      参考链接
     </h2>
     <ul>
      <li>
       <a href="https://dl.ooclab.com/otunnel/1.3.1/">
        https://dl.ooclab.com/otunnel/1.3.1/
       </a>
      </li>
      <li>
       <a href="https://www.oschina.net/p/otunnel">
        对称的安全隧道工具 otunnel
       </a>
      </li>
     </ul>
    </article>
   </div>
   <!-- Footer -->
   <footer id="footer">
    <p class="copyright">
     © Untitled. Design:
     <a href="https://html5up.net">
      HTML5 UP
     </a>
     .
    </p>
   </footer>
  </div>
  <!-- BG -->
  <div id="bg">
  </div>
  <!-- Scripts -->
  <script src="../assets/js/jquery.min.js">
  </script>
  <script src="../assets/js/browser.min.js">
  </script>
  <script src="../assets/js/breakpoints.min.js">
  </script>
  <script src="../assets/js/util.js">
  </script>
  <script src="../assets/js/main.js">
  </script>
 </body>
</html>
